<template>
  <van-nav-bar title="首页" fixed placeholder/>
  <!-- 轮播 -->
  <van-swipe :autoplay="3000" lazy-render>
  <van-swipe-item v-for="image in images" :key="image">
    <img  class="item-img" :src="image" />
  </van-swipe-item>
</van-swipe>

<!-- 资讯 -->
<!-- 设置垂直间距 -->
<van-row :gutter="[20, 20]" class="list">
  <van-col span="12"
  v-for="item in ListArr" 
  :key="item.id"
  @click="$router.push('/articles?id=' + item.id)">
<span></span>
</van-col>
</van-row>


</template>

<script setup>
import { arctileListRequest } from '@/api/act';
import { bannerRequest, noticesListRequest } from '@/api/news';
import { productListRequest } from '@/api/product';
import { ref } from 'vue'
import { useRouter } from 'vue-router';

let router = useRouter();

const images = ref([]);
bannerRequest().then(r => {
  console.log(r.data);
  
})
noticesListRequest().then(r => {
  console.log(r.data);
  ListArr.value = r.data
})

productListRequest().then(r => {
  console.log(r.data);
})

arctileListRequest().then(r => {
  console.log(r.data);
  
})
const ListArr = ref([])
</script>


<style scoped>
  .item-img{
    width: 100vw;
    height: 30vh;
  }
</style>
